/*
 *    Copyright (c) 2018-2025, shenghua All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright
 * notice, this list of conditions and the following disclaimer in the
 * documentation and/or other materials provided with the distribution.
 * Neither the name of the pig4cloud.com developer nor the names of its
 * contributors may be used to endorse or promote products derived from
 * this software without specific prior written permission.
 * Author: shenghua
 */

package com.chen.base.module.redis.service;

import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * @author shenghua
 * @since 2021/9/4 10:50
 */
public interface CacheService {

	boolean expire(String key, long time);

	boolean expire(String key, long time, boolean tenantFlag);

	Long getExpire(String key);

	Long getExpire(String key, boolean tenantFlag);

	Boolean hasKey(String key);

	Boolean hasKey(String key, boolean tenantFlag);

	void del(String... key);

	void del(boolean tenantFlag, String... key);

	Object get(String key);

	Object get(String key, boolean tenantFlag);

	boolean set(String key, Object value);

	boolean set(String key, Object value, boolean tenantFlag);

	boolean set(String key, Object value, long time);

	boolean set(String key, Object value, long time, boolean tenantFlag);

	Long incr(String key, long delta);

	Long incr(String key, long delta, boolean tenantFlag);

	Long decr(String key, long delta);

	Long decr(String key, long delta, boolean tenantFlag);

	Object hget(String key, String item);

	Object hget(String key, String item, boolean tenantFlag);

	Map<Object, Object> hmget(String key);

	Map<Object, Object> hmget(String key, boolean tenantFlag);

	boolean hmset(String key, Map<String, Object> map);

	boolean hmset(String key, Map<String, Object> map, boolean tenantFlag);

	boolean hmset(String key, Map<String, Object> map, long time);

	boolean hmset(String key, Map<String, Object> map, long time, boolean tenantFlag);


	boolean hset(String key, String item, Object value);

	boolean hset(String key, String item, Object value, boolean tenantFlag);

	boolean hset(String key, String item, Object value, long time);

	boolean hset(String key, String item, Object value, long time, boolean tenantFlag);


	void hdel(String key, Object... item);

	void hdel(boolean tenantFlag, String key, Object... item);

	boolean hHasKey(String key, String item);

	boolean hHasKey(String key, String item, boolean tenantFlag);

	double hincr(String key, String item, double by);

	double hincr(String key, String item, double by, boolean tenantFlag);

	double hdecr(String key, String item, double by);

	double hdecr(String key, String item, double by, boolean tenantFlag);

	Set<Object> sGet(String key);

	Set<Object> sGet(String key, boolean tenantFlag);

	Boolean sHasKey(String key, Object value);

	Boolean sHasKey(String key, Object value, boolean tenantFlag);

	Long sSet(String key, Object... values);

	Long sSet(boolean tenantFlag, String key, Object... values);

	Long sSetAndTime(String key, long time, Object... values);

	Long sSetAndTime(boolean tenantFlag, String key, long time, Object... values);


	Long sGetSetSize(String key);

	Long sGetSetSize(String key, boolean tenantFlag);

	List sPop(String key, Integer count);

	Long sSize(String key);

	long setRemove(String key, Object... values);

	Long setRemove(boolean tenantFlag, String key, Object... values);

	<T> List<T> lGetAll(String key,Class<T> tClass);

	List<Object> lGet(String key, long start, long end);

	List<Object> lGet(String key, long start, long end, boolean tenantFlag);

	long lGetListSize(String key);

	Long lGetListSize(String key, boolean tenantFlag);

	Object lGetIndex(String key, long index);

	Object lGetIndex(String key, long index, boolean tenantFlag);


	boolean lSet(String key, Object value);

	boolean lSet(String key, Object value, boolean tenantFlag);


	boolean lSet(String key, Object value, long time);

	boolean lSet(String key, Object value, long time, boolean tenantFlag);


	boolean lSet(String key, List<Object> value);

	boolean lSet(String key, List<Object> value, boolean tenantFlag);

	boolean lSet(String key, List<Object> value, long time);

	boolean lSet(String key, List<Object> value, long time, boolean tenantFlag);


	boolean lUpdateIndex(String key, long index, Object value);

	boolean lUpdateIndex(String key, long index, Object value, boolean tenantFlag);


	long lRemove(String key, long count, Object value);

	Long lRemove(String key, long count, Object value, boolean tenantFlag);

}
